package cn.gpdi.framework.service;

import cn.gpdi.framework.dao.CommDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Created by 司徒鑫(QQ:156845600) on 2018/8/12.
 */
@Service
public class FwCommService {
    @Autowired
    CommDAO commDAO;

    public Object dbExcute(String mapperidCfg, Object param) throws Exception {
        String mapperType = mapperidCfg.substring(mapperidCfg.length() - 1, mapperidCfg.length());
        if (mapperType.equals("U")) {
            return commDAO.update(mapperidCfg, (Map) param);
        } else if (mapperType.equals("Q")) {
            return commDAO.select(mapperidCfg, (Map) param);
        } else if (mapperType.equals("D")) {
            return commDAO.delete(mapperidCfg, (Map) param);
        } else if (mapperType.equals("I")) {
            return commDAO.insert(mapperidCfg, (Map) param);
        }
        return null;
    }
}
